<?php
/**
 * Created By   : robertwilson
 * Date         : 5/4/13
 * Time         : 3:19 PM
 * File         : Session.php
 * Class        : Session
 */
session_name('ipmc_assmt');
session_start();

class Session
{

    public static function set($key = null, $value = null)
    {
        if (!is_null($key) && !is_null($value)) {
            $_SESSION[$key] = $value;
        }
    }

    public static function get($key = null)
    {
        if (!is_null($key) && array_key_exists($key, $_SESSION)) {
            return $_SESSION[$key];
        }
    }

    public static function checkUser()
    {
        if (!array_key_exists('sessionToken', $_SESSION)) {
            header('Location: ../');
            exit;
        }
    }

    public static function clearSession()
    {
        unset($_SESSION['sid']);
        unset($_SESSION['sessionToken']);
        unset($_SESSION['email']);
        session_destroy();
        header('Location: ../');
        exit;
    }
}
